/**
* Program   :   MailBean.java
* Author    :   shadow guo
* Create    :   2010-1-11 上午07:07:34
*
* Copyright 2008 by Tongfu Information Technology Co. Ltd
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Tongfu Information Technology Co. Ltd. ("Confidential Information").  You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Tongfu Information Technology Co. Ltd.
* 
*/

/**
 * 
 */
package com.tongfusoft.utils.mail;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import org.apache.commons.lang.StringUtils;



/**
 * @author shadowguo
 *
 */
public class MailBean {
	private String mailServser = "";          //发送信箱服务器.
	private String protocol = "";            //邮件传输协议. 其值smtp, pop3  
    private String password = "";           //发送信箱用户密码.
	private String from = "";              //发送邮件的信箱.
	private String to   = "";             //接收邮件信箱.
	private String subject = "";         //邮件主题.
	private String textMsg = "";    //信息主体.
	private String htmlMsg = "";
	private List<String> cc = new ArrayList<String>();
	private Hashtable file = new Hashtable();  //文件附件.
	private List url = new ArrayList();  //url附件.
	private String charSet = "UTF-8";
	private boolean isSSL = false;
	private int smtpPort = 25;
	
	private String sendSystem = ""; //record用
	private String sendUser = "";//record用
	private String attachId = "";//reacord用
	
	
	/**
	 * @return the attachId
	 */
	public String getAttachId() {
		return attachId;
	}
	/**
	 * @param attachId the attachId to set
	 */
	public void setAttachId(String attachId) {
		this.attachId = attachId;
	}
	/**
	 * @return the sendSystem
	 */
	public String getSendSystem() {
		return sendSystem;
	}
	/**
	 * @param sendSystem the sendSystem to set
	 */
	public void setSendSystem(String sendSystem) {
		this.sendSystem = sendSystem;
	}
	/**
	 * @return the sendUser
	 */
	public String getSendUser() {
		return sendUser;
	}
	/**
	 * @param sendUser the sendUser to set
	 */
	public void setSendUser(String sendUser) {
		this.sendUser = sendUser;
	}
	/**
	 * @return the smtpPort
	 */
	public int getSmtpPort() {
		return smtpPort;
	}
	/**
	 * @param smtpPort the smtpPort to set
	 */
	public void setSmtpPort(int smtpPort) {
		this.smtpPort = smtpPort;
	}
	/**
	 * @return the mailServser
	 */
	public String getMailServser() {
		return mailServser;
	}
	/**
	 * @param mailServser the mailServser to set
	 */
	public void setMailServser(String mailServser) {
		this.mailServser = mailServser;
	}
	/**
	 * @return the protocol
	 */
	public String getProtocol() {
		return protocol;
	}
	/**
	 * @param protocol the protocol to set
	 */
	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}
	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}
	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}
	/**
	 * @return the from
	 */
	public String getFrom() {
		return from;
	}
	/**
	 * @param from the from to set
	 */
	public void setFrom(String from) {
		this.from = from;
	}
	/**
	 * @return the to
	 */
	public String getTo() {
		return to;
	}
	/**
	 * @param to the to to set
	 */
	public void setTo(String to) {
		this.to = to;
	}
	/**
	 * @return the subject
	 */
	public String getSubject() {
		return subject;
	}
	/**
	 * @param subject the subject to set
	 */
	public void setSubject(String subject) {
		this.subject = subject;
	}
	/**
	 * @return the textMsg
	 */
	public String getTextMsg() {
		return textMsg;
	}
	/**
	 * @param textMsg the textMsg to set
	 */
	public void setTextMsg(String textMsg) {
		this.textMsg = textMsg;
	}
	/**
	 * @return the htmlMsg
	 */
	public String getHtmlMsg() {
		return htmlMsg;
	}
	/**
	 * @param htmlMsg the htmlMsg to set
	 */
	public void setHtmlMsg(String htmlMsg) {
		this.htmlMsg = htmlMsg;
	}
	/**
	 * @return the cc
	 */
	public List<String> getCc() {
		return cc;
	}
	/**
	 * @param cc the cc to set
	 */
	public void setCc(List<String> cc) {
		this.cc = cc;
	}
	
	public String getCcString(){
		if(this.cc != null){
			StringBuffer strbuff = new StringBuffer();
			for(String address : cc){
				strbuff.append(address).append(",");
			}
			
			if(strbuff.length() > 1){
				return strbuff.substring(0, strbuff.length()-1).toString();
			}
		}
		
		return "";
	}
	
	public String getMailContent(){
		if(StringUtils.isNotEmpty(this.getHtmlMsg())){
			return this.getHtmlMsg();
		}
		
		if(StringUtils.isNotEmpty(this.getTextMsg())){
			return this.getTextMsg();
		}
		
		return "";
	}
	
	/**
	 * @return the file
	 */
	public Hashtable getFile() {
		return file;
	}
	/**
	 * @param file the file to set
	 */
	public void setFile(Hashtable file) {
		this.file = file;
	}
	/**
	 * @return the url
	 */
	public List getUrl() {
		return url;
	}
	/**
	 * @param url the url to set
	 */
	public void setUrl(List url) {
		this.url = url;
	}
	/**
	 * @return the charSet
	 */
	public String getCharSet() {
		return charSet;
	}
	/**
	 * @param charSet the charSet to set
	 */
	public void setCharSet(String charSet) {
		this.charSet = charSet;
	}
	/**
	 * @return the isSSL
	 */
	public boolean isSSL() {
		return isSSL;
	}
	/**
	 * @param isSSL the isSSL to set
	 */
	public void setSSL(boolean isSSL) {
		this.isSSL = isSSL;
	}
	
	
}
